var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/baseComponent/radio.tsx
var radio_exports = {};
__export(radio_exports, {
  Radio: () => Radio,
  RadioGroup: () => RadioGroup
});
module.exports = __toCommonJS(radio_exports);
var import_antd = require("antd");
var import_util = require("../util");
var Radio = (0, import_util.compHoc)(import_antd.Radio);
var RadioGroupComp = (0, import_util.compHoc)(
  class extends import_util.IUPComponent {
    constructor(props) {
      super(props);
      this.onRadioChange = (e) => {
        const value = e && e.target ? e.target.value : e;
        if (this.props.hasOwnProperty("value")) {
          this.state.value = value;
          this.props.onChange && this.props.onChange(value);
        } else {
          this.setValue(value);
        }
        this.innerNotify([value], "onChange").then();
      };
      this.state.value = props.defaultValue;
    }
    static getDerivedStateFromProps(nextProps, prevState) {
      return import_util.IUPComponent.propsToState(nextProps, prevState, ["value"]);
    }
    setValue(value, cb) {
      if (this.state.value === value) {
        return;
      }
      this.setState(
        (prev) => ({ ...prev, value }),
        () => {
          this.props.onChange && this.props.onChange(value);
          cb && cb(value);
        }
      );
    }
    getValue() {
      return this.state.value;
    }
    render() {
      const { data, value, options, onChange, observer, ...others } = this.props;
      return /* @__PURE__ */ React.createElement(
        import_antd.Radio.Group,
        {
          options: options || data,
          ref: this.outRef,
          ...others,
          value: this.state.value,
          onChange: this.onRadioChange
        }
      );
    }
  }
);
var RadioGroup = RadioGroupComp;
RadioGroup.Option = import_antd.Radio.Button;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Radio,
  RadioGroup
});
